#!/sbin/openrc-run

name="MuMuDVB"
command="/usr/bin/mumudvb"
command_background="true"
pidfile="/var/run/mumudvb/mumudvb.pid"
daemonuser="mumudvb"

checkconfig() {
	if [ ! -f "$CONFIG_FILE" ] ; then
		eerror "You need to setup $CONFIG_FILE first. Install $pkgname-doc for examples"
		return 1
	fi
}


depend() {
        need net
        after firewall
}

start () {
		checkconfig || return 1
        ebegin "Starting $name"
		start-stop-daemon --start --name mumudvb_$ADAPTER \
    		--make-pidfile --pidfile $pidfile \
        	--user $daemonuser --exec $command -- $COMMAND_ARGS --card $ADAPTER -c $CONFIG_FILE
        eend $?
}

stop () {
        ebegin "Stopping $name"
        start-stop-daemon --stop --pidfile $pidfile \
        	--exec $command
        eend $?
}

